import { EventEmitter } from '@stencil/core';

// eslint-disable-next-line @typescript-eslint/ban-types
export type ComponentRef = Function | HTMLElement | string | null;

// export interface OverlayEventDetail<T = any> {
//   data?: T;
//   role?: string;
// }

export interface OverlayInterface {
  /**
   * 当前组件实例
   *
   * @author chitanda
   * @date 2021-05-12 13:05:29
   * @type {HTMLElement}
   */
  el: HTMLElement;
  /**
   * 是否支持按键关闭
   *
   * @author chitanda
   * @date 2021-05-12 13:05:42
   * @type {boolean}
   */
  keyboardClose: boolean;
  /**
   * 当前显示的zIndex层级
   *
   * @author chitanda
   * @date 2021-05-12 13:05:54
   * @type {number}
   */
  overlayIndex: number;
  /**
   * 是否已经打开
   *
   * @author chitanda
   * @date 2021-05-12 13:05:28
   * @type {boolean}
   */
  presented: boolean;
  /**
   * 关闭事件
   *
   * @author chitanda
   * @date 2021-05-12 13:05:33
   * @type {EventEmitter<any>}
   */
  didDismiss: EventEmitter<any>;
  /**
   * 需要渲染的组件
   *
   * @author chitanda
   * @date 2021-05-12 13:05:32
   * @type {ComponentRef}
   */
  component: ComponentRef;
  /**
   * 组件输入属性
   *
   * @author chitanda
   * @date 2021-05-12 13:05:03
   * @type {Record<string, unknown>}
   */
  componentProps: Record<string, unknown>;
  /**
   * 打开
   *
   * @description 注解：Method
   * @author chitanda
   * @date 2021-04-05 14:04:24
   * @return {*}  {Promise<void>}
   */
  present(): Promise<void>;

  /**
   * 关闭
   *
   * @description 注解：Method
   * @author chitanda
   * @date 2021-04-05 18:04:41
   * @param {*} data
   * @return {*}  {Promise<void>}
   */
  dismiss(data?: any): Promise<boolean>;

  /**
   * 窗口关闭事件
   *
   * @description 注解：Method
   * @author chitanda
   * @date 2021-04-05 18:04:33
   * @return {*}  {Promise<any>}
   */
  onDidDismiss(): Promise<any>;
}
